{% load endless %}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title></title>
    <script src="/static/scripts/jquery-1.4.1.min.js"></script>
    <script type="text/javascript" src="/static/scripts/diffprices.js"></script>
    <link href="/static/css/diffprices/styles.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<a href="/logout/">Выйти</a>
<a href="/admin/">Главная</a>
<a href="/catalogs/davilki/{{ filter_url }}&davilka=nadavi">Nadavi прайс</a>
<a href="/catalogs/davilki/{{ filter_url }}&davilka=hotline">Hotline прайс</a>
<a href="/catalogs/davilki/{{ filter_url }}&davilka=priceua">Price.ua прайс</a>
{% paginate products %}
<input type="button" onclick="update()" value="Обновление данных"/>
<a href="/diffprices/?name=&price=&priceFrom=&priceTo=&priceAvg=&priceDiffFrom=&priceDiffTo=&status=включен&owner=&color=">Сброс
    фильтра</a>
<table border="1" class="" id="t">
    <thead>
    <form action="/diffprices/" method="GET">
        <tr>
            <th><input name="name" type="text" value="{{ filter.name }}"></th>
            <th><input name="price" type="text" value="{{ filter.price }}"></th>
            <th><input name="priceFrom" type="text" value="{{ filter.priceFrom }}"></th>
            <th><input name="priceTo" type="text" value="{{ filter.priceTo }}"></th>
            <th><input name="priceAvg" type="text" value="{{ filter.Avg }}"></th>
            <th><input name="priceDiffFrom" type="text" value="{{ filter.priceDiffFrom }}"></th>
            <th><input name="priceDiffTo" type="text" value="{{ filter.priceDiffTo }}"></th>
            <th>
                <select name="status">
                    <option {% ifequal filter.status "" %}selected{% endifequal %}></option>
                    <option {% ifequal filter.status "включен" %}selected{% endifequal %}>включен</option>
                    <option {% ifequal filter.status "выключен" %}selected{% endifequal %}>выключен</option>
                </select>
            </th>
            <th>
                <select name="owner">
                    <option {% ifequal filter.owner "" %}selected{% endifequal %}></option>
                    {% for owner in owners %}
                        <option {% ifequal filter.owner owner %}selected{% endifequal %}>{{ owner }}</option>
                    {% endfor %}
                </select>
            </th>
            <th>
                <select name="special_price">
                    <option {% ifequal filter.special_price "" %}selected{% endifequal %}></option>
                    {% for special_price in special_prices %}
                        <option
                                {% ifequal filter.special_price special_price %}selected{% endifequal %}>{{ special_price }}</option>
                    {% endfor %}
                </select>
            </th>
        </tr>
        <input type="submit" value="Найти">
        Ценовой диапазон:
        <select name="color">
            <option {% ifequal filter.color "" %}selected{% endifequal %}></option>
            <option {% ifequal filter.color "red" %}selected{% endifequal %} class="red">red</option>
            <option {% ifequal filter.color "green" %}selected{% endifequal %} class="green">green</option>
            <option {% ifequal filter.color "yellow" %}selected{% endifequal %} class="yellow">yellow</option>
            <option {% ifequal filter.color "gray" %}selected{% endifequal %} class="gray">gray</option>
        </select>
        <tr>
            <th><a href="{{ request.get_full_path }}&sort=name&sorting={{ sorting }}">Назва товару</a></th>
            <th><a href="{{ request.get_full_path }}&sort=price&sorting={{ sorting }}">Наша ціна</a></th>
            <th><a href="{{ request.get_full_path }}&sort=priceFrom&sorting={{ sorting }}">Ціна від</a></th>
            <th><a href="{{ request.get_full_path }}&sort=priceTo&sorting={{ sorting }}">Ціна до</a></th>
            <th><a href="{{ request.get_full_path }}&sort=priceAvg&sorting={{ sorting }}">Середня ціна</a></th>
            <th>Різниця ціни від</th>
            <th>Різниця ціни до</th>
            <th><a href="{{ request.get_full_path }}&sort=status&sorting={{ sorting }}">Статус</a></th>
            <th><a href="{{ request.get_full_path }}&sort=owner&sorting={{ sorting }}">Власник</a></th>
            <th><a href="{{ request.get_full_path }}&sort=special_price&sorting={{ sorting }}">Акційний товар</a></th>
        </tr>
    </form>
    </thead>
    <tbody id="fbody">
    {% for product in products %}
        <tr class="{{ product.type }}">
            <td>{{ product.name }}</td>
            <td>{{ product.price }}</td>
            <td>{{ product.priceFrom }}</td>
            <td>{{ product.priceTo }}</td>
            <td>{{ product.priceAvg }}</td>
            <td>{{ product.diffPriceFrom }}</td>
            <td>{{ product.diffPriceTo }}</td>
            <td>{{ product.status }}</td>
            <td>{{ product.owner }}</td>
            <td>{{ product.special_price }}</td>
        </tr>
    {% endfor %}
    </tbody>
    {% show_pages %}
</table>
</body>
</html>